package com.cosc716.restaurant.domain;

import java.util.ArrayList;

public class Order {

	private int orderNo;
	private ArrayList<OrderItem> items;
	private double totalprice;
	private boolean isComplete;
	private Customer customer;
    public Order(int orderNo, Customer customer)
    {
    	this.orderNo=orderNo;
     	items= new ArrayList<OrderItem>();
     	totalprice=0;
    	this.customer=customer;
    	}
     public int getOrderNo()
    {
    	return orderNo;
    }
    
    public int getPeopleNo(int peopleNo)
    {
    	return peopleNo;
    }
    public double getTotalprice(double totalprice)
    {
    	return totalprice;
    }

    public Customer getCustomer()
    {
    	return customer;
    }
    public void setIsComplete(boolean isComplete)
    {
    	 this.isComplete=isComplete;
    }
    
     public boolean getIsComplete()
    {
    	return isComplete;
    }
    public ArrayList<OrderItem> getItems()
    {
    	return items;
    }
    
 
    public void addOrderItem(OrderItem item)
    {
    	items.add(item);
    	totalprice+=item.getTotalPrice();
    
    	
    }
    
    public void deleteOrderItem(OrderItem item)
    {
    	items.remove(item);
    	totalprice-=item.getTotalPrice();
    	
    }
    

    public String toString()
    {
    	String result = "Order No:"+"\t" + orderNo+"\n";
    	result+="Itemname\t quantity\t price\n";
    	for(OrderItem item:items)
    		result+=item;
    	if(getIsComplete()==true)
    		result+="Order is complete";
    		else
    			result+="Order is in progress";
    	return result;
    		
    		
    }
    
   
}


   



